{include file="public/head"}
{include file="public/left"}
<!-- content -->

<div class="main_02_r">

    <!--内容区域-->
    <div class="site_01">
        <span>当前位置：</span><a href="#">城事社</a><i>></i><a href="#">基本服务</a>
    </div>

    <div class="nrq_01">
        <div class="gg_01">
            <span class="on">客服</span><span><a href="{:url('basic/advice')}">投诉建议</a></span><span><a href="{:url('basic/aboutUs')}">关于我们</a></span><span><a href="{:url('basic/technical')}">技术服务</a></span>
        </div>
        <div class="gg_02">
            <div class="gg_03">

                <div class="jbkh_01">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <th>序号</th>
                            <th>客服名称</th>
                            <th>二维码</th>
                            <th>说明文字</th>
                        </tr>
                        {volist name="arr" id="vo"}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.service_name}</td>
                            <td>
                                <em class="em_erm">
                                    <img src="{$vo.code_url}" />
                                    <a href="#" class="erm_add"></a>
                                </em>
                            </td>
                            <td>
                                <em class="em_sm">
                                    <input type="text" class="jbkh_txt" id="remark_{$vo.id}" maxlength="20" value="{$vo.remark}" placeholder="" />
                                    <input type="button" class="jbkh_btn" onclick="serviceEdit('{$vo.id}')" value="" />
                                </em>
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>

            </div>
        </div>

    </div>

</div>
<script type="text/javascript">
    $(function(){
        var layer = layui.layer,form = layui.form;
    })
    function serviceEdit(id) {
        var remark = $("#remark_"+id).val();
        if(remark.length > 20){
            layer.msg("说明文字长度不能超过20");
            return;
        }
        ajax_psot("{:url('basic/ajax_service_edit')}",{"id":id,"remark":remark});
    }
    function ajax_psot(url,data){
        $.ajax({
            url:url,
            type: "POST",//方法类型
            // dataType: "json",//预期服务器返回的数据类型
            data: data,
            success: function (data) {
                if (data.code === 1) {
                    layer.msg("<span style='margin-left: 18px;'>"+data.msg+"</span>",{icon: 1,time:1000},function(){
                        window.location.href=data.url;
                    });
                }else{
                    layer.msg("<span style='margin-left: 18px;'>"+data.msg+"</span>",{icon: 2,time:1000},function(){
                        /*if(data.url){
                            window.location.href=data.url;
                        }else{
                            location.reload();
                        }*/
                    });
                }
            },
            error : function() {
                layer.msg("<span style='margin-left: 18px;'>请求错误,请联系管理员</span>",{icon: 0,time:1000},function(){
                    //location.reload();
                });
            }
        });
    }
</script>
<!-- content -->
{include file="public/foot"}
